<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$("#searchQuery").click(function(){
		var url = "/${initParam.context_root}/searchQueryByTxt.do";
		$("#sqlForm").attr("action",url);
	});
	$("#saveExcel").click(function(){
		var url = "/${initParam.context_root}/saveExcel.do";
		$("#sqlForm").attr("action",url);
	});
});
</script>
<title>VIEW FOR SEARCH QUERY </title>
</head>
<body>
<div align="center">
	<form id="sqlForm" name="sqlForm" method="post" >
		<div style="width:100%; border: 1 1 1 1; border-style: solid; border-color: lightgray;">
			<div align="left"><b> ◈ 쿼리를 정리하여 입력하세요.</b></div>
			<div align="right"> <span id="message" style="float: left;"><font style="font-weight: bold" color="red">${message }</font></span>
				<button id="saveExcel" style="cursor: pointer;">【  저장 】</button>&nbsp;&nbsp;&nbsp;<button id="searchQuery" style="cursor: pointer;">【 검색 】</button></div>
		</div><br>
		<div style="width: 100%; border: 1 1 1 1; border-style: solid; border-color: lightgray;">
			<textarea rows="20" cols="100%" name="txtSql" id="txtSql" ><c:if test="${not empty sqlTxt }">${sqlTxt}</c:if></textarea>
		</div><br>
	</form>
	<div style="width:100%; border: 1 1 1 1; border-style: solid; border-color: lightgray;">
	<div align="left"><b>총 건수 : ${TotalCount }</b></div>
		<div style="padding:10px 40px 10px 40px;">
		<c:choose>
			<c:when test="${not empty tableHead }">
			<table cellpadding="5" width="100%" border="1" cellspacing="0" style="border-style:double; border-width: 3px;">
				<thead id="thead" style="background-color: lightgray;"><c:choose><c:when test="${not empty tableHead }">${tableHead}</c:when></c:choose></thead>
				<tbody id="tbody"><c:choose><c:when test="${not empty tableTd }">${tableTd}</c:when></c:choose></tbody>	
			</table>
			</c:when>
			<c:otherwise>
				<div align="left"> <font color="blue" style="font-style: italic;">상태 : 대기</font></div>
			</c:otherwise>
		</c:choose>
		</div><br>
	</div>
</div>
</body>
</html>